var el=document.getElementById("<?php echo $_GET['el'] ?>"),
 p="<?php echo(isset($_GET['p'])?$_GET['p']:'') ?>",
  w=p.split(';'),wc=w.length,wi,wdef;

alert('hello');

el.data=new Array();
el.labels=new Array();
//el.events=new Array();
el.tags=new Array();
el.vars=new Array();



for(
    wi=0,label=0,event=0,default=0,tag=0;
    wi<wc;
    ++wi){
  if(w[wi].substr(0,1)=='?'){
    el.labels[label]=w[wi].substr(1); ++label;
  }
  else if(w[wi].substr(0,1)=='@'){ <?php include'_events.php' ?> }
  else if(w[wi].substr(0,1)=='!'){
    el.vars=w[wi].substr(1); ++var;
  }
  else if(w[wi].substr(0,1)=='%'){
  }
  else if(w[wi].substr(0,1)=='$'){
    el.tags=w[wi].substr(1); ++tag;
  }
  else if(w[wi].substr(0,1)=='_'){
      el.data[datum]=w[wi].substr(1); ++datum;
  }
  else{
    el.data[datum]=w[wi]; ++datum;
    //    if(){    }
  }
}

el.innerHTML=(el.label?el.label:'');
el.txt=document.createElement("input");
el.txt.size=3;
el.txt.style.textAlign="right";
el.txt.parent=el;
el.appendChild(el.txt);

el.units=document.createElement("select");
var ui,ul=units.length,uo;
for(ui=0;ui<ul;++ui){
  uo=document.createElement("option");
  ut=document.createTextNode(units[ui]);
  if(units[ui]==el.unit)uo.selected="selected";
  uo.appendChild(ut);
  el.units.appendChild(uo);
}
el.units.parent=el;
el.appendChild(el.units);

el.units.addEventListener("change",setunits,false);
el.txt.addEventListener("change",setunits,false);

//alert(el.innerHTML);

function setunits(e){
  e.target.parent.unit=e.target.parent.units.value;
  var v=e.target.parent.txt.value;
  if(parseFloat(v)==v || parseInt(v)==v){
    e.target.parent.value=v+e.target.parent.unit;
  }
}